<?php
namespace BP\GPM;
require_once("BP/Web/WebUser.php");
class Bars extends EntitiesNoName {
	public static function constructor__ () 
	{
		$me = new self();
		return $me;
	}
	public function getNewEntity () 
	{
		return Bar::constructor__();
	}
	public function ToJavaList () 
	{
		return $this;
	}
	public function Tolist () 
	{
		$list = [];// 
		for ($i = 0; ($i < $this->size()); ++$i) 
		{
			$list->add($this->get($i));
		}
		return $list;
	}
	public function RetrieveAll () 
	{
		$als = $ClassFactory->GetObjects("BP.GPM.BarBase");
		foreach ($als as $item) 		{
			if (($item == NULL))
			{
				continue;
			}
			$en = $item;
			if (($en == NULL))
			{
				continue;
			}
			$bar = Bar::constructor__();
			$bar->setNo($en->getNo());
			$bar->setName($en->getName());
			$bar->setTitle($en->getTitle());
			$bar->setMoreUrl($en->getMore());
			$bar->setHeight($en->getHeight());
			$bar->setWidth($en->getWidth());
			$bar->Save();
			if (($en->getIsCanView() ==  FALSE ))
			{
				continue;
			}
			$barEmp = BarEmp::constructor__();
			$barEmp->setMyPK((($en->getNo() . "_") . $WebUser->getNo()));
			$i = $barEmp->RetrieveFromDBSources();
			$barEmp->setFK_Bar($en->getNo());
			$barEmp->setFK_Emp($WebUser->getNo());
			$barEmp->setIsShow( TRUE );
			$barEmp->setTitle($en->getName());
			if (($i == 0))
			{
				$barEmp->Insert();
			}
		}
		return parent->RetrieveAll();
	}
}
?>
